/**
* edcOptionChart functions
* copyright@Catosoft.com reserved, 2016
* 2016.07.30, created by Eric.Wang
*/



/*
* get data
*/
var getedcOptionData = function(){
	var data = {

	};
	var option = {
		url: '/draft/project/edc/v1',
		type: 'GET',
		data: data,
	};
	createAjax(option, function(err, res){
		if(!err){
			projectBasicTable('projectBasicTable', res);
			ecrBasicTable('ecrBasicTable', res);
		}
	});
}

/*
* draw charts
*/
var projectBasicTable = function(element, data){
	$('#' + element).bootstrapTable({
		data: [data],
		classes: 'table table-hover',
		pagination: false,
		pageSize: 20,
		pageNumber: 1,
		pageList: [20, 50],
		sidePagination: 'client',
		showRefresh: true,
		showColumns: true,
		buttonsAlign: 'right',
		toolbar: '.projectBasic',
		showExport: true,
		exportDataType: 'all',
		exportTypes: ['csv', 'txt', 'excel'],
		locale: 'zh-CN',
		columns: [
		{
			field: 'Number',  
	    title: '序号',  
	    formatter: function (value, row, index) {  
	    	return index + 1;  
	    }
		},
		{
			title: '项目',
			field: 'project_name',
		}, {
			title: '申办方',
			field: 'operatiog_parties',
		}, {
			title: 'CRO',
			field: 'cro',
		}, {
			title: '适应证',
			field: 'adaptive_capacity',
		}, {
			title: '样本量',
			field: 'sample_size',
		}, {
			title: '疗程',
			field: 'treatment',
		}, {
			title: '中心数',
			field: 'center_number',
		}, {
			title: '用户数',
			field: 'user_number',
		}],

	});
}

var ecrBasicTable = function(element, data){
	$('#' + element).bootstrapTable({
		data: [data],
		classes: 'table table-hover',
		pagination: false,
		pageSize: 20,
		pageNumber: 1,
		pageList: [20, 50],
		sidePagination: 'client',
		showRefresh: true,
		showColumns: true,
		toolbar: '.ecrBasic',
		buttonsAlign: 'right',
		showExport: true,
		exportDataType: 'all',
		exportTypes: ['csv', 'txt', 'excel'],
		locale: 'zh-CN',
		columns: [
		{
			field: 'Number',  
	    title: '序号',  
	    formatter: function (value, row, index) {  
	    	return index + 1;  
	    }
		},
		{
			title: '字段',
			field: 'char_number',
		}, {
			title: 'editcheck',
			field: 'editcheck',
		}, {
			title: 'EDC核查',
			field: 'edc_check',
		}, {
			title: '人工人核查',
			field: 'human_check',
		}, {
			title: '理论数据点',
			field: 'theory_date_number',
		}, {
			title: '实际数据点',
			field: 'real_date_number',
			formatter: function(value, row){
				return value + '(' + row.date_rate + '%)';
			},
		}],

	});
}

$(function(){
	getedcOptionData();
});